<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<meta name="apple-mobile-web-app-capable" content="yes" />
		<meta name="apple-mobile-web-app-status-bar-style" content="black" />
		<meta name="format-detection" content="telephone=no" />
		<meta name="format-detection" content="email=no" />
		<meta content="yes" name="apple-mobile-web-app-capable">
		<meta content="yes" name="apple-touch-fullscreen">
		<meta content="telephone=no,email=no" name="format-detection">
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=0" />

		<title>web1</title>

		<link rel="stylesheet" href="css/jquery.mobile-1.4.5.min.css" />
		<link rel="stylesheet" href="css/appStyle.css" />
		<link rel="stylesheet" href="css/toast.css" />
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script type="text/javascript" src="js/jquery.mobile-1.4.5.min.js"></script>
		<script type="text/javascript" src="js/toast.js"></script>

		<script type="text/javascript">
			function doLogin() {
				var name = $("#USERNAME").val();
				var pwd = $("#PASSWORD").val();
				$.ajax({
					data: {
						"USERNAME": name,
						"PASSWORD": pwd
					},
					dataType: "json",
					type: "get",
					url: "login",
					success: function(result) {
						console.log("Success");

						if(result.RESULT) {

							LoginOK();

						} else {

							LoginError();

						}
					}

				});
			}

			function LoginOK() {
				showMessage('登录成功', 1000);
			}

			function LoginError() {
				showMessage('账户或密码错误', 1000);
			}
		</script>
	</head>

	<body>
		<div data-role="page" id="info">
			<div data-role="header">
				<h1>空调管家</h1>
			</div>
			<div class="appMargin">

				<div>
					<a>账户：<input type="text" id="USERNAME"></a>
				</div>
				<div>
					<a>密码：<input type="password" id="PASSWORD"></a>
				</div>
				<div>
					<button onclick='doLogin()'>登录</button>

				</div>

			</div>

	</body>

</html>